import { useState, } from 'react'

function Son(props) {
  console.log(11, props);
  const { age, cb } = props


  return (
    <div>
      <div>son:{props.name}--{age}</div>
      <button onClick={() => cb(1)}>改变父的信息</button>
    </div>
  )
}

function App() {
  const [msg, setMsg] = useState(0)

  const getSonMsg = (e) => {
    console.log(123, e);
    setMsg(msg + e)
  }
  return (
    <div >
      <h1>react组件 </h1>
      <h2>{msg}</h2>
      <Son name={'名字'} age={15} bool={false} list={['vue', 'react']} obj={{ work: 'webjob' }} cb={getSonMsg} child={<span>this is span</span>} />
    </div>
  )
}

export default App
